package com.cimpm.task.controller;

import com.cimpm.task.entity.TaskFlow;
import com.cimpm.task.service.impl.TaskFlowServiceImpl;
import com.cimpm.task.service.impl.TaskInstanceServiceImpl;
import com.cimpm.task.service.impl.TaskOrderServiceImpl;
import com.hby.common.annotation.Remind;
import com.hby.common.annotation.aspect.AutoEntityProcess;
import com.hby.common.annotation.aspect.NoEntityAutoSingleProcess;
import com.hby.common.annotation.handler.AutoRequestBody;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/taskFlow")
@CrossOrigin
public class TaskFlowController {

    @Remind("工作流相关，先有工作流，再有工作流配置-taskOrder")
    @AutoEntityProcess(BUSINESS_CLASS = TaskFlow.class, LOG_MSG = "taskFlow", PERMISSION_TYPE = "234")
    public Object taskFlowAuto(@AutoRequestBody Map<String, Object> param){
        return null;
    }

    @Remind("按照权限获取工作流，dataPermission:taskAdmin 可看所有工作流，权限暂定 default、taskManager、taskAdmin")
    @RequestMapping("/getTaskFlowCanEdit")
    @NoEntityAutoSingleProcess(SERVICE_CLASS = TaskFlowServiceImpl.class,PARAM_FIELD = "",NO_VALID_FIELD = "",LOG_MSG = "getTaskFlow",
                MENU_CODE = 1105,PERMISSION_TYPE="5",USE_USERINFO = true)
    public Object getTaskFlowCanEdit(@AutoRequestBody Map<String, Object> param){
         return null;
    }

    @RequestMapping("/getTaskFlowCanProcess")
    @NoEntityAutoSingleProcess(SERVICE_CLASS = TaskFlowServiceImpl.class,PARAM_FIELD = "",NO_VALID_FIELD = "",LOG_MSG = "getTaskFlow",
            MENU_CODE = 1105,PERMISSION_TYPE="5",USE_USERINFO = true)
    public Object getTaskFlowCanProcess(@AutoRequestBody Map<String, Object> param){
        return null;
    }

    @Remind("获取工作流的配置内容")
    @RequestMapping("/getFlowOrder")
    @NoEntityAutoSingleProcess(SERVICE_CLASS = TaskOrderServiceImpl.class,PARAM_FIELD = "flowId",NO_VALID_FIELD = "",LOG_MSG = "getFlowOrder",
                MENU_CODE = -1,PERMISSION_TYPE="5",USE_USERINFO = false)
    public Object getFlowOrder(@AutoRequestBody Map<String, Object> param){
         return null;
    }

    @RequestMapping("/createInstance")
    @NoEntityAutoSingleProcess(SERVICE_CLASS = TaskInstanceServiceImpl.class,PARAM_FIELD = "flowId",NO_VALID_FIELD = "",LOG_MSG = "createTaskInstance",
                MENU_CODE = 1105,PERMISSION_TYPE="2",USE_USERINFO = true)
    public Object createInstance(@AutoRequestBody Map<String, Object> param){
         return null;
    }
}
